﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using eLuk.CommandEngine;
using Windows.Networking.Sockets;
using Windows.Networking;
using Windows.Storage.Streams;

namespace eLuk.Runtime
{
	public class IMAPInitialState : IMAPState, IConnectable
	{
		public override void Change( IMAPSession session )
		{
			session.CurrentState = new IMAPConnectedState();
		}

		public async Task Connect( IMAPSession session )
		{
			session.Engine = new IMAPCommandEngine();
			await session.Engine.InitializeAsync( session.Server );

			if ( session.Engine.Channel != null && session.Engine.Channel.IsConnected == true )
				session.CurrentState = new IMAPConnectedState();
		}

	}
}
